home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume89
/
kernel
/
xoper20.1
< prev
next >
Wrap
Internet Message Format
|
1989-10-28
|
66KB
Path: xanth!ames!sun-barr!newstop!sun!swap!root
From: root%swap@Sun.COM (Operator)
Newsgroups: comp.sources.amiga
Subject: v89i190: xoper - examine & control your kernel, Part01/03
Message-ID: <127005@sun.Eng.Sun.COM>
Date: 28 Oct 89 07:15:31 GMT
Sender: news@sun.Eng.Sun.COM
Lines: 2844
Approved: page@sun.com
Submitted-by: g35@dhdurz1@bitnet (Werner Guenther)
Posting-number: Volume 89, Issue 190
Archive-name: kernel/xoper20.1
Changes in V2.0:
The user interface has been rewritten from scratch, and a small iconify
routine has been added.
To customize the whole thing a little bit, there are a few new commands:
MinimumChars, HistoryLines, ShowHistory, KillHistory, OutputLines,
IconifyOff, BackDropIcon, UseScreen, UseWindow.
Other new commands include:
TimerIO, RemResident, Repeat, TrapGuru, Setfont, DiskChange, Alias,
SaveOutput.
Addresses are now shown as 32-Bit values for 68020 compatibility.
'display commands' separated by blanks will display the lists
one by one rather than all at once.
The 'interrupt list' has two new fields.
'Time' w/o parameters shows current setting.
The 'More' command is obsolete and has been removed.
[NOTE: The source file was too big to fit in one posting, so I broke
it into three parts, labeled xoper.a1 though xoper.a3. Once you
unshar all three parts, join the three .aX files into Xoper.a ..bob]
# This is a shell archive.
# Remove anything above and including the cut line.
# Then run the rest of the file through 'sh'.
# Unpacked files will be owned by you and have default permissions.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: SHell ARchive
# Run the following text through 'sh' to create:
# xoper.a1
# This is archive 1 of a 3-part kit.
# This archive created: Fri Oct 27 23:48:52 1989
echo "extracting xoper.a1"
sed 's/^X//' << \SHAR_EOF > xoper.a1
X******************************************
X* *
X* Xoper 2.0 Copyright (C) Werner Gunther *
X* *
X******************************************
X* Written for the A68K Assembler *
X* (Fish 110) by Charlie Gibbs and *
X* Brian R. Anderson *
X* *
X* Do not use Smallcode/Smalldata when *
X* linking *
X******************************************
X;DEBUG SET 1
X XREF _LVOSwitch
X XREF _LVOAddTask
X XDEF _SysBase
Xsysbase equ 4
X
XCALL MACRO
X xref _LVO\1
X move.l \2,a6
X jsr _LVO\1(a6)
X ENDM
XLIBCALL MACRO
X xref _\1
X jsr _\1
X ENDM
X
XADDCMD MACRO
Xcmdnum set cmdnum+1
X dc.b \1,0
X ENDM
X
X;Program startup. If called from DOS we
X;use segment splitting to detach
X;from our DOS-task.
Xstart moveq #3,d0
X lea dummyinput,a1
Xgetparm move.b (a0)+,(a1)+
X dbf d0,getparm
X move.b #10,in
X lea conname(PC),a1
X move.l sysbase,a0
X lea 350(a0),a0
X CALL FindName,sysbase
X move.l d0,condev
X lea dosname(PC),a1
X move.l sysbase,a0
X lea 378(a0),a0
X move.l a0,-(a7)
X CALL FindName,sysbase
X move.l d0,dosbase
X move.l 0(a7),a0
X lea gfxname(PC),a1
X CALL FindName,sysbase
X move.l d0,gfxbase
X move.l (a7)+,a0
X lea intuiname(PC),a1
X CALL FindName,sysbase
X move.l d0,intuibase
X move.l d0,a0
X move.l $38(a0),a0
X move.w 12(a0),d0
X sub.w #550,d0
X move.w d0,window_l
X
X move.l sysbase,a4
X move.l 276(a4),a4
X tst.l $ac(a4)
X bne.s notwb
X lea $5c(a4),a0
X CALL WaitPort,sysbase
X lea $5c(a4),a0
X CALL GetMsg,sysbase
X move.l d0,wbmsg
X move.w #$740a,in
Xnotwb:
X IFND DEBUG
X lea xopcon,a1
X CALL FindPort,sysbase
X tst.l d0
X bne oops
X ENDC
X tst.l wbmsg
X beq.s fromdos
X jmp mainprg
X
Xfromdos:
X
Xstarttask:
X
X IFND DEBUG
X cmp.w #'-b',dummyinput
X bne.s stt1
X CALL Output,dosbase
X move.l d0,-(a7)
X move.l #windowname,d2
X move.l d0,d1
X moveq.l #newname-windowname-1,d3
X CALL Write,dosbase
X move.l #cr,d2
X move.l (a7)+,d1
X moveq.l #1,d3
X CALL Write,dosbase
Xstt1 lea start(PC),a1
X move.l -4(a1),d3
X move.l d3,myseg
X
X move.l #mainprg,d3
X subq #4,d3
X lsr.l #2,d3
X
X clr.l -4(a1)
X CALL Forbid,sysbase
X move.l #newname,d1
X clr.l d2
X move.l #3500,d4
X CALL CreateProc,dosbase
X CALL Permit,sysbase
X moveq #0,d0
X rts
Xoops suba.l a0,a0
X CALL DisplayBeep,intuibase
X CALL Forbid,sysbase
X move.l wbmsg,d0
X beq.s leave
X move.l d0,a1
X CALL ReplyMsg,sysbase
X moveq #0,d0
Xleave rts
X
Xdosname dc.b 'dos.library',0
Xintuiname dc.b 'intuition.library',0
Xgfxname dc.b 'graphics.library',0
Xconname dc.b 'console.device',0
X EVEN
X
Xmain CODE xoper
X ENDC
Xmainprg move.l sysbase,a0
X move.l a0,_SysBase
X move.l a7,realstack
X move.l 276(a0),a0 ;ExecBase->ThisTask
X move.l a0,mytask
X move.l 50(a0),oldproctrap ;original AmigaDos Trap-Handler
X move.l #newname,10(a0)
X pea 0
X pea xopcon
X LIBCALL CreatePort
X addq #8,a7
X move.l d0,replyport
X pea 0
X pea 0
X LIBCALL CreatePort
X addq #8,a7
X move.l d0,timerport
X lea timerio,a1
X move.l d0,14(a1)
X move.l d0,a2
X move.b 15(a2),d0
X ext.w d0
X move.w d0,timersig
X lea timernam(PC),a0
X moveq #0,d1
X moveq #1,d0
X CALL OpenDevice,_SysBase(PC) ;open 'timer.device'
X
X;install a counter to determine the amount of CPU-time each
X;Task uses.
X move.l _SysBase(PC),a1
X move.l #_LVOSwitch,a0
X move.l 2(a1,a0),oldswitch
X move.l #myswitch,d0
X CALL SetFunction,_SysBase(PC)
X;install a counter for PORT-Interrupts
X lea IOCounter(PC),a1
X moveq #3,d0
X CALL AddIntServer,_SysBase(PC)
X
X;Attempt to open a startup script
X move.l mytask(PC),a4 ;disable the 'please insert'
X move.l 184(a4),-(a7)
X move.l #-1,184(a4) ;requester
X move.l #startupname+2,d1 ;'Xoper.Startup'
X move.l #1005,d2
X CALL Open,dosbase(PC)
X tst.l d0
X bne.s 7$
X move.l #startupname,d1 ;'S:Xoper.Startup'
X move.l #1005,d2
X CALL Open,dosbase(PC)
X
X7$ move.l (a7)+,184(a4) ;reenable the requester
X move.l d0,infile
X beq.s nostartup
X
X6$ move.b #1,fromfile
X
X8$ lea dummy,a5
X moveq #-1,d5
X5$ addq.l #1,d5
X move.l infile(PC),d1
X move.l a5,d2
X add.l d5,d2
X moveq.l #1,d3
X CALL Read,dosbase(PC)
X tst.l d0
X bgt.s 10$
X
X move.l infile(PC),d1
X CALL Close,dosbase(PC)
X clr.l infile
X tst d5
X beq.s endstartup
X bra.s 9$
X
X10$ cmp.b #10,0(a5,d5)
X beq.s 9$
X cmp.b #13,0(a5,d5)
X bne.s 5$
X
X9$ move.l d5,d0
X addq #1,d0
X bsr cli ;execute the script as if typed in
X tst.l infile
X bne.s 8$
X
Xendstartup clr.b fromfile
X
Xnostartup tst.l wbmsg
X bne.s noin
X cmp.b #10,dummyinput
X beq.s noin
X cmp.w #'-b',dummyinput ;requested as a background task ?
X beq.s noin
X move.l dummyinput,in
X move.b #10,in+4
X bra.s nostartup2
Xnoin cmp.b #10,in
X beq.s default
X tst.b in
X bne.s nostartup2
X
Xdefault move.w #$740a,in ;couldn't find defaults, defaults to
X ;tasks
X
Xnostartup2 cmp.w #'-b',dummyinput
X beq instback
X
X;This code just opens a Window. Position
X;and size are taken from window_l,window_t,
X;window_w,window_h.
Xrestart tst.b ownscreen
X beq.s 1$
X bsr createscreen
X bra.s 2$
X1$ bsr setupwindow
X
X2$ move.l mytask(PC),a0
X clr.l 26(a0) ;clear 'spurious' signals
X
X clr.l ptr
X tst.b gotguru
X
X beq.s 3$
X bsr showguru
X clr.b gotguru
X3$ bra processmsgs
X
X;show a list. The string entered from keyboard is stored
X;in 'in'.Every character is interpreted as one command
X;i.e. 'rip' means 'resources'+'interrupts'+'ports'.
X;search the command to be executed. If none is found,
X;show a help message
X
Xshowwhat tst.b fromfile
X bne endshow
X move.w cmdptr(PC),d7
X
Xinput lea in,a0
X move.b 0(a0,d7.w),d0
X beq endshow
X addq.b #1,d7
X cmpi.b #' ',d0
X bne.s 1$
X
X bsr testifend
X beq endshow
X move.w d2,cmdptr
X bra notfinished
X
X1$ cmpi.b #10,d0
X beq endshow
X or.b #32,d0
X cmpi.b #'q',d0
X beq exit
X lea params(PC),a0
X moveq #0,d1
Xi1 cmp.b 0(a0,d1),d0
X beq.s foundp
X addq.b #1,d1
X cmpi.b #parmnum,d1
X bne.s i1
X
X move.l #usetxt,d0
X move.b #1,mnflag
X bsr putnam
X clr.b mnflag
X bra endshow
X
Xfoundp lsl.b #2,d1
X lea subs(PC),a0
X move.b #1,mnflag
X jsr 0(a0,d1)
X clr.b mnflag
X bsr testifend
X beq input
X bsr newline
X bra input
X
Xtestifend lea in,a0
X lea 0(a0,d7),a0
X move.w d7,d2
X2$ move.b (a0)+,d0
X beq.s 1$
X cmpi.b #' ',d0
X bne.s 3$
X addq #1,d2
X bra.s 2$
X3$ cmpi.b #10,d0
X1$ rts
X
X
Xendshow tst.b fromfile
X bne.s nomore
X clr.w cmdptr
Xnotfinished bsr starttimer
Xnomore tst.b fromfile
X bne.s 1$
X clr.l lastprinted
X bsr blastout
X1$ rts
X
X;get the string from inputbuffer; search and execute
X;the command, if any.
X
Xcli lea dummy,a0
X subq #1,d0
Xcl2 subq #1,d0
X bmi.s cl1
X cmp.b #' ',0(a0,d0)
X beq.s cl2
Xcl1 addq #1,d0
X move.b #10,0(a0,d0)
X bsr kllblnks
X cmpi.b #10,0(a0)
X beq showwhat
X cmpi.b #';',0(a0)
X beq nomore
X
X bsr findcmd
X tst.l d2
X bpl.s okcmd
X bsr findalias
X tst.l d2
X bmi.s nm1
X
Xokcmd clr.b procnum
X adda.w d1,a0
X bsr kllblnks
X lsl #2,d2
X lea cmdaddr(PC),a1
X jsr 0(a1,d2)
X bra nomore
X
Xnm1 lea in,a1
X lea buffer,a2
Xnm2 move.b (a1)+,(a2)+
X cmp.b #10,-1(a1)
X bne.s nm2
X lea in,a1
Xnm0 move.b (a0)+,(a1)+
X cmp.b #10,-1(a1)
X bne.s nm0
X lea dummy,a2
X lea buffer,a1
Xnm3 move.b (a1)+,(a2)+
X cmp.b #10,-1(a1)
X bne.s nm3
X clr.w cmdptr
X bra showwhat
X
Xfindcmd bsr strbuf
X move.l a0,a5
X lea commds(PC),a2
X moveq #0,d2
X1$ lea buffer,a0
X move.l a2,a1
X bsr strcmp
X beq 3$
X2$ tst.b (a2)+
X bne.s 2$
X addq #1,d2
X cmp.w #cmdnum,d2
X bne.s 1$
X moveq #-1,d2
X3$ move.l a5,a0
X rts
X
Xfindalias move.l a0,a5
X move.l aliaslist(PC),d4
X1$ beq.s 3$
X move.l d4,a4
X lea buffer,a0
X lea 5(a4),a1
X move.b 4(a4),d2
X ext.w d2
X ext.l d2
X bsr strcmp
X beq 4$
X move.l 0(a4),d4
X bra.s 1$
X3$ moveq #-1,d2
X4$ move.l a5,a0
X rts
X
Xsubs bra showtask
X bra showaddr
X bra showdevs
X bra showlibs
X bra showres
X bra showresi
X bra showmem
X bra showprt
X bra showint
X bra stack
X bra clicomm
Xcmdaddr bra settime
X bra taskpri
X bra info
X bra pri
X bra flush
X bra freeze
X bra warm
X bra signal
X bra break
X bra alert
X bra lastalert
X bra hold
X bra stopall
X bra clear
X bra cancel
X bra taskports
X bra hunks
X bra devices
X bra openlib
X bra closelib
X bra currentdir
X bra cd
X bra mypri
X bra openfiles
X bra locks
X bra unlock
X bra screens
X bra windows
X bra closescreen
X bra closewindow
X bra fonts
X bra windowfonts
X bra lockdrive
X bra freedrive
X bra capture
X bra clrcold
X bra clrcool
X bra clrwarm
X bra snoop
X bra usage
X bra inphand
X bra nohead
X bra sort
X bra hide
X bra hidden
X bra setwindow
X bra cancel
X bra iconifyoff
X bra historylines
X bra historylength
X bra showhistory
X bra repeatcmd
X bra remresident
X bra saveoutput
X bra killhistory
X bra iconbackdrp
X bra setfont
X bra trapguru
X bra outputlines
X bra usescreen
X bra usewindow
X bra grabtimerio
X bra dchange
X bra alias
X bra remnode
X
X;------ Task-Structures-----
X
Xshowaddr clr.b tasktyp
X bra.s startask
Xshowtask move.b #1,tasktyp
Xstartask tst.b headon
X beq noheader1
X move.l #infoh1,d0
X bsr putstr
X move.l _SysBase(PC),a6
X move.l #cpu2,d0
X btst #1,297(a6) ;SysBase->AttnFlags
X bne.s cpupr
X move.l #cpu1,d0
X btst #0,297(a6)
X bne.s cpupr
X move.l #cpu0,d0
Xcpupr bsr putstr
X move.l _SysBase(PC),a6
X btst #2,297(a6)
X beq.s no881
X move.l #cpu3,d0
X bsr putstr
Xno881 moveq #20,d1
X bsr tab
X move.l #infoh3,d0
X bsr putstr
X
Xnoheader1 move.l _SysBase(PC),a6
X move.w #$4000,$dff09a
X move.l 280(a6),d0
X move.l 284(a6),d1
X move.l oldidl,d3
X move.l d0,oldidl
X sub.l d3,d0
X move.l olddisp,d3
X move.l d1,olddisp
X sub.l d1,d3
X move.l d0,d1
X sub.l d3,d1
X move.l d1,maxdisp
X move.l d3,-(a7)
X movem.l d0-d3,-(a7)
X moveq #1,d5
X bsr getaskdat
X move.l a5,savedat
X movem.l (a7)+,d0-d3
X sub.l d3,d0
X neg.l d3
X tst.b headon
X beq.s noheader2
X bsr prcent
X bsr newline
X move.l #infoh2,d0
X bsr putstr
Xnoheader2 move.l (a7)+,d0
X neg.l d0
X move.l d0,dispatches
X tst.b headon
X beq noheader3
X mulu #100,d0
X move.l d0,-(a7)
X
X lea secs(PC),a0
X lea mics(PC),a1
X CALL CurrentTime,intuibase(PC)
X move.l secs(PC),d3
X lsl.l #1,d3
X move.l d3,d1
X lsl.l #2,d3
X add.l d1,d3
X move.l mics(PC),d0
X move.l #100000,d1
X bsr div
X add.l d0,d3
X move.l time10(PC),d1
X move.l d3,time10
X sub.l d1,d3
X move.l (a7)+,d0
X move.l d3,-(a7)
X move.l d3,d1
X bsr div
X moveq #1,d5
X bsr putfrac
X
X moveq #20,d1
X bsr tab
X move.l #infoh7,d0
X bsr putstr
X move.l iocount(PC),d0
X clr.l iocount
X mulu #100,d0
X move.l (a7)+,d3
X move.l d3,d1
X bsr div
X moveq #1,d5
X bsr putfrac
X
X bsr newline
X bsr newline
Xnoheader3 lea theader(PC),a0
X tst.b tasktyp
X bne.s phedder
X lea t2header(PC),a0
Xphedder bsr puthead
X move.l savedat(PC),a5
X
Xpt1 tst.b entries
X beq pt2
X lea -16(a5),a5
X bsr hideit
X tst d0
X beq ptend
X move.l 0(a5),a4
X move.l a4,d0
X move.l d0,node
X bsr hexa
X tst.b tasktyp
X beq.s pt12
X moveq #0,d0
X move.b 8(a4),d0
X bsr gettype
X
Xpt12 moveq #0,d0
X move.b 9(a5),d0
X subq.b #1,d0
X mulu #10,d0
X move.l #status,d1
X add.l d1,d0
X bsr putstr
X tst.b tasktyp
X bne.s pt13
X
X move.l 18(a4),d0
X bsr hexa
X move.l #longnix,d0
X cmp.b #4,9(a5)
X beq.s pt14
X bsr putstr
X bra.s pt15
Xpt14 move.l 22(a4),d0
X bsr hexa
Xpt15 move.l 26(a4),d0
X bsr hexa
X move.l 54(a4),a1
X move.l 0(a1),d0
X cmp.b #2,9(a5)
X bne.s pt16
X move.l #*,d0
Xpt16 bsr hexa
X bra pt4
X
Xpt13 move.b 10(a5),d3
X bsr plusmins
X
X move.l dispatches(PC),d0
X tst.b usageflag
X beq.s pt37
X move.l maxdisp(PC),d0
Xpt37 move.l 12(a5),d3
X bsr prcent
X
X clr.b d3
X cmpi.b #13,8(a5)
X bne.s noproc
X tst.l 172(a4)
X beq.s noproc
X move.b 11(a5),d3
X bsr bytedec
X bra.s pt4
Xnoproc move.l #nix,d0
X bsr putstr
Xpt4 move.l 4(a5),d0
X bsr putnam
Xptend subq.b #1,entries
X bra pt1
Xpt2 rts
X
Xputlist move.l 0(a4),a4
X tst.l 0(a4)
X beq.s endlist
X bsr putdata
X bra.s putlist
Xendlist rts
X
Xputdata move.l a4,0(a5)
X move.l 10(a4),4(a5) ;task->ln_Name
X move.b 8(a4),8(a5) ;task->ln_Type
X move.b 15(a4),9(a5) ;task->tc_State
X move.b 9(a4),10(a5) ;task->ln_Pri
X move.b 143(a4),11(a5) ;Process->pr_Tasknum
X clr.l 12(a5)
X lea cputime,a0
X move.l tasksnum(PC),d1
X subq #1,d1
X bmi.s pua1
Xpua3 cmp.l (a0)+,a4
X dbeq d1,pua3
X tst d1
X bmi.s pua1
Xpua2 move.l 508(a0),12(a5)
Xpua1 lea 16(a5),a5
X addq.b #1,entries
X rts
X
Xgettype and.l #$f,d0
X mulu #11,d0
X add.l #type,d0
X bra putstr
X
Xgetaskdat move.l d5,-(a7)
X lea buffer,a5
X clr.b entries
X lea stplist(PC),a4
X bsr putlist
X move.l _SysBase(PC),a4
X lea 420(a4),a4 ;SysBase->TaskWait
X bsr putlist
X move.l _SysBase(PC),a4
X lea 406(a4),a4 ;SysBase->TaskReady
X bsr putlist
X move.l _SysBase(PC),a4
X move.l 276(a4),a4 ;SysBase->ThisTask
X bsr putdata
X move.l (a7)+,d5
X beq.s 1$
X clr.l tasksnum
X1$ move.w #-$4000,$dff09a
X moveq #16,d2
X lea -32(a5),a2
X bsr.s sortlist
X rts
X
Xsortlist tst.b sorton
X beq.s sort5
X lea buffer,a3
Xsort1 lea 0(a3,d2),a4
Xsort2 move.l 0(a3),d1
X cmp.l 0(a4),d1
X bge.s sort3
X move.l d2,d1
X subq #1,d1
Xsort4 move.b 0(a4,d1),d0
X move.b 0(a3,d1),0(a4,d1)
X move.b d0,0(a3,d1)
X dbf d1,sort4
Xsort3 lea 0(a4,d2),a4
X cmp.l a2,a4
X ble.s sort2
X lea 0(a3,d2),a3
X cmp.l a2,a3
X bne.s sort1
Xsort5 rts
X
Xprcent lsl.l #1,d3
X move.l d3,d1
X lsl.l #2,d3
X add.l d1,d3
X lsl.l #2,d3
X move.l d3,d1
X lsl.l #3,d3
X move.l d3,d2
X lsl.l #1,d3
X add.l d2,d3
X add.l d1,d3
X move.l d0,d1
X move.l d3,d0
X bsr div
X moveq #0,d5
X bsr putfrac
X move.l #infoh4,d0
X bra putstr
X
Xputfrac divu #10,d0
X move d0,d3
X swap d0
X move d0,d1
X tst d5
X bne.s 1$
X cmp.w #100,d3
X ble.s 1$
X move.l #whatsthis,d0
X bra putstr
X1$ bsr bytedec
X lea out,a0
X move.b #'.',-1(a0,d0)
X or.b #'0',d1
X move d1,d0
X bra putchar
X
Xhideit tst.b hideon
X bne.s pt73
Xpt75 moveq #1,d0
X rts
Xpt73 lea hidestart(PC),a4
X move.l 4(a5),a0
Xpt74 tst.l 0(a4)
X beq.s pt75
X move.l 0(a4),a4
X lea 4(a4),a1
X bsr strcmp
X tst d0
X beq hideend
X bra.s pt74
Xhideend rts
X*-------- mem-hunks ------------
X
Xshowmem lea mheader(PC),a0
X bsr puthead
X move.l _SysBase(PC),a5
X lea 322(a5),a5 ;SysBase->MemList
X moveq #0,d5
Xmem1 move.l 0(a5),a5 ;MemList->ln_Next
X tst.l 0(a5)
X beq.s mem2
X move.l 20(a5),d0 ;MemHeader->mh_Lower
X bsr hexa
X move.l 24(a5),d0 ;MemHeader->mh_Upper
X bsr hexa
X move.l 28(a5),d0 ;MemHeader->mh_Free
X add.l d0,d5
X moveq #1,d3
X bsr longdec
X move.b 15(a5),d3 ;MemHeader->mh_Attributes
X bsr bytedec
X move.b 9(a5),d3 ;MemHeader->ln_pri
X bsr plusmins
X move.l 10(a5),d0 ;MemHeader->ln_Name
X move.l a5,node
X bsr putnam
X bra.s mem1
Xmem2 move.l #infoh6,d0
X bsr putstr
X moveq #19,d1
X bsr tab
X moveq #0,d3
X move.l d5,d0
X bsr longdec
Xnewline move.l #cr,d0
X bra putstr
X
X*-------- Task-Stack ------------
X
Xstack lea stackhead(pc),a0
X bsr puthead
X moveq #0,d5
X bsr getaskdat
Xsta1 tst.b entries
X beq sta8
X lea -16(a5),a5
X bsr hideit
X tst d0
X beq sta9
X move.l 0(a5),a1
X cmp.b #13,8(a1) ;task->ln_Type
X bne.s sta6
X move.l 172(a1),d0
X beq.s sta6
X lsl.l #2,d0
X move.l d0,a0
X tst.l 60(a0)
X beq.s sta6
X moveq #1,d3
X move.l 52(a0),d4
X lsl.l #2,d4
X move.l 176(a1),d0
X sub.l d4,d0
X bsr hexa
X move.l d4,d0
X bsr longdec
X move.l 176(a1),d0
X sub.l 54(a1),d0
X bra.s sta7
X
Xsta6 move.l 58(a1),d0
X bsr hexa
X moveq #1,d3
X move.l 62(a1),d0
X sub.l 58(a1),d0
X bsr longdec
X move.l 62(a1),d0
X sub.l 54(a1),d0
Xsta7 bsr longdec
X move.l 4(a5),d0
X bsr putnam
Xsta9 subq.b #1,entries
X bra sta1
Xsta8 rts
X
Xclicomm lea clicomhead(pc),a0
X bsr puthead
X moveq #0,d5
X bsr getaskdat
Xclic1 tst.b entries
X beq clic8
X lea -16(a5),a5
X bsr hideit
X tst d0
X beq clic0
X move.l 0(a5),a4
X cmpi.b #13,8(a4)
X bne clic0
X tst.l 172(a4)
X beq clic0
X move.l 140(a4),d3
X beq clic0
X move.l a4,d0
X move.l d0,node
X bsr hexa
X moveq #0,d0
X move.b 9(a5),d0
X subq #1,d0
X mulu #10,d0
X move.l #status,d1
X add.l d1,d0
X bsr putstr
X move.l 172(a4),a3
X adda.l a3,a3
X adda.l a3,a3
X move.l #script,d0
X tst.l 40(a3)
X beq.s clic5
X move.l #interact,d0
Xclic5 bsr putstr
X move.l #backg,d0
X tst.l 44(a3)
X bne.s clic6
X move.l #foreg,d0
Xclic6 bsr putstr
X bsr bytedec
X move.l 4(a5),d0
X bsr putstr
X moveq #49,d1
X bsr tab
X move.b #' ',d0
X bsr putchar
X move.l 128(a4),d0
X beq.s noprogloadc
Xclic3 move.l 172(a4),d1
X bne.s clic4
Xnoprogloadc move.l #longnix,d0
X bsr putnam
X bra.s clic0
Xclic4 lsl.l #2,d1
X move.l d1,a4
X move.l 60(a4),d1
X beq.s noprogloadc
X move.l 16(a4),d0
X bsr putbcpl
X bsr newline
X
Xclic0 subq.b #1,entries
X bne clic1
Xclic8 rts
X
X*--------- interrupts ------------
Xshowint lea iheader(PC),a0
X bsr puthead
X lea intnames(PC),a5
X lea inttyp(PC),a4
X moveq #0,d1
X moveq #15,d5
X move.l _SysBase(PC),a3
X lea 84(a3),a3 ;SysBase->IntVects[16]
X
Xsi0 tst.b 0(a4,d1)
X bne.s si4
X move.l 8(a3),a2 ;IntVector->iv_Node
X bra.s si5
Xsi4 move.l 0(a3),a2 ;Interrupt->is_Node
Xsi5 cmp.l #0,a2
X beq nxtint
X tst.b 0(a4,d1)
X beq.s si1
Xsi2 move.l 0(a2),a2 ;is_Node->ln_Next
X tst.l 0(a2)
X beq.s nxtint
Xsi1 move.l a2,d0
X move.l d0,node
X bsr hexa
X move.l 14(a2),d0 ;Interrupt->is_Data
X bsr hexan
X move.l 18(a2),d0 ;Interrupt->is_Code
X bsr hexan
X move.b 9(a2),d3 ;Interrupt->ln_Pri
X move.l a3,-(a7)
X bsr plusmins
X move.l #intserv,d0
X tst.b 0(a4,d1)
X bne.s 1$
X move.l #inthand,d0
X1$ bsr putstr
X move.l #intdis,d0
X move.w $dff01c,d3
X btst.w d1,d3
X beq.s 2$
X move.l #inten,d0
X2$ bsr putstr
X move.l (a7)+,a3
X move.l a5,d0
X bsr putstr
X move.l 10(a2),d0 ;Interrupt->ln_Name
X bsr putnam
X tst.b 0(a4,d1)
X bne.s si2
X tst.l 0(a2)
X beq.s nxtint
X move.l 0(a2),a2
X bra si1
Xnxtint addq #1,d1
X lea 12(a5),a5
X lea 12(a3),a3
X dbf d5,si0
X rts
X
X*--------- resident ------------
X
Xshowresi lea rheader(PC),a0
X bsr puthead
X move.l _SysBase(PC),a5
X move.l 300(a5),a5 ;SysBase->ResModules
X
Xr1 tst.l 0(a5)
X beq r2
X move.l 0(a5),d0 ;Resident->ln_Next
X tst.l d0
X bpl.s r3
X bclr #31,d0
X movea.l d0,a5
X bra.s r1
Xr3 movea.l d0,a4
X move.l d0,node
X bsr hexa
X move.b 13(a4),d3 ;rt_Pri
X bsr plusmins
X move.b 10(a4),d0 ;rt_Flags
X bsr bin
X move.b 11(a4),d3 ;rt_Version
X bsr bytedec
X move.b 12(a4),d0 ;rt_Type
X bsr gettype
X move.l 14(a4),d0 ;rt_Name
X bsr putnam
Xr4 addq #4,a5
X bra r1
Xr2 rts
X
X*--------- ports -------------
X
Xshowprt lea pheader(PC),a0
X bsr puthead
X move.l _SysBase(PC),a4
X lea 392(a4),a4 ;SysBase->PortList
X lea buffer,a5
X moveq #0,d5
X CALL Forbid,_SysBase(PC)
X move.w #$4000,$dff09a
Xsp2 move.l 0(a4),a4 ;mp_Node.ln_Next
X tst.l 0(a4)
X beq.s sp20
X bsr getpdata
X bra.s sp2
Xsp20 tst.b tports
X bne.s sp15
X move.l _SysBase(PC),a4
X move.l 276(a4),a4 ;sysbase->ThisTask
X lea 92(a4),a4 ;process->pr_MsgPort
X bsr getpdata
X move.l _SysBase(PC),a2
X lea 406(a2),a2
Xsp11 move.l 0(a2),a2
X tst.l 0(a2)
X beq.s sp14
X lea 92(a2),a4
X cmp.b #13,8(a2)
X bne.s sp11
X bsr getpdata
X bra sp11
Xsp14 move.l _SysBase(PC),a2
X lea 420(a2),a2
Xsp12 move.l 0(a2),a2
X tst.l 0(a2)
X beq.s sp15
X lea 92(a2),a4
X cmp.b #13,8(a2)
X bne.s sp12
X bsr getpdata
X bra sp12
Xsp15 move.w #-$4000,$dff09a
X CALL Permit,_SysBase(PC)
X lea buffer,a5
Xsp3 tst.b d5
X beq sp6
X move.l 0(a5),d0
X move.l d0,node
X bsr hexa
X move.l 4(a5),d0
X bsr putstr
X moveq #25,d1
X bsr tab
X move.b 8(a5),d0
X and.l #3,d0
X mulu #9,d0
X add.l #mp_flags,d0
X bsr putstr
X move.b 9(a5),d3
X bsr bytedec
X move.b 14(a5),d3
X cmp.b #255,d3
X bne.s 1$
X move.l #toomuch,d0
X bsr putstr
X bra.s 2$
X1$ bsr bytedec
X2$ move.l #longnix,d0
X move.l 10(a5),d1
X beq.s sp8
X move.l d1,a3
X move.l 10(a3),d0
Xsp8 bsr putnam
X lea 16(a5),a5
X subq.b #1,d5
X bra sp3
Xsp6 rts
X
Xgetpdata move.l a4,0(a5)
X move.l 10(a4),4(a5) ;ln_Name
X move.b 14(a4),8(a5) ;mp_Flags
X move.b 15(a4),9(a5) ;mp_SigBit
X move.l 16(a4),10(a5) ;mp_SigTask
X moveq #0,d0
X movea.l 20(a4),a3 ;mp_MsgList
Xsp10 movea.l 0(a3),a3
X cmpa.l #0,a3
X beq.s sp9
X addq.b #1,d0
X cmp.b #255,d0
X bne.s sp10
Xsp9 move.b d0,14(a5)
X lea 16(a5),a5
X addq.b #1,d5
X rts
X*-------- resources ------------
X
Xshowres lea lheader(PC),a0
X bsr puthead1
X lea resnam(PC),a0
X bsr puthead2
X move.l _SysBase(PC),d5
X add.l #336,d5 ;SysBase->ResourceList
X bsr show
X rts
X
X*--------- devices -------------
X
Xshowdevs lea lheader(PC),a0
X bsr puthead1
X lea devnam(PC),a0
X bsr puthead2
X move.l _SysBase(PC),d5
X add.l #350,d5 ;SysBase->DeviceList
X bsr show
X rts
X
X*-------- libraries -------------
X
Xshowlibs lea lheader(PC),a0
X bsr puthead1
X lea libnam(PC),a0
X bsr puthead2
X move.l _SysBase(PC),d5
X add.l #378,d5 ;SysBase->LibList
X
Xshow lea buffer,a5
X clr.b entries
X CALL Forbid,_SysBase(PC)
X move.l d5,a4
Xsl1 move.l 0(a4),a4 ;lib_Node.ln_Next
X tst.l 0(a4)
X beq.s sl2
X addq.b #1,entries
X move.l a4,0(a5)
X move.l 10(a4),4(a5) ;ln_Name
X move.b 33(a4),8(a5) ;lib_OpenCnt
X move.b 21(a4),9(a5) ;lib_Version
X move.b 23(a4),10(a5) ;lib_Revision
X move.b 14(a4),11(a5) ;lib_Flags
X lea 12(a5),a5
X bra.s sl1
Xsl2 CALL Permit,_SysBase(PC)
X
X lea buffer,a5
Xdl3 tst.b entries
X beq.s sl4
X move.l 0(a5),d0
X move.l d0,node
X bsr hexa
X move.b 8(a5),d3
X bsr bytedec
X move.b 9(a5),d3
X bsr bytedec
X move.b 10(a5),d3
X bsr bytedec
X move.b 11(a5),d0
X bsr bin
X move.l 4(a5),d0
X bsr putnam
X lea 12(a5),a5
X subq.b #1,entries
X bra.s dl3
Xsl4 rts
X
X;Remove a resident module from the list. Clears the rt_Matchword
X;to avoid being found and reinserted during the next reset
Xremresident bsr nodenam2
X cmp.b #'$',0(a5)
X bne.s 1$
X move.l a5,a0
X bsr readhex
X tst.b d7
X bne.s 2$
X1$ move.l a5,a1
X CALL FindResident,_SysBase(PC)
X tst.l d0
X beq fn5
X
X2$ move.l _SysBase(PC),a3
X move.l 300(a3),a3 ;SysBase->ResModules
X
X8$ move.l (a3)+,d1
X beq fn5
X bpl.s 3$
X bclr #31,d1
X movea.l d1,a3
X bra.s 8$
X3$ cmp.l d1,d0
X bne.s 8$
X
X4$ move.l a3,a4
X5$ tst.l (a4)+
X bgt.s 5$
X
X6$ move.l d0,a1
X clr.w 0(a1) ;rt_MatchTag
X move.l a4,d0
X sub.l a3,d0
X lsr #2,d0
X subq #1,d0
X lea -4(a3),a1
X7$ move.l (a3)+,(a1)+
X dbf d0,7$
X rts
X
X;find the first entry in the device-list
X;returns a1 = pointer to first entry
X
Xdevinfo move.l dosbase(PC),a1
X move.l 34(a1),a1
X move.l 24(a1),a1
X adda.l a1,a1
X adda.l a1,a1
X move.l 4(a1),a1
X rts
X
X;unlock a file
Xunlock tst.b fromfile
X bne ul6
X bsr readhex
X tst.b d7
X beq syntax
X move.l d0,remembr
X move.l d0,-(a7)
X moveq #-1,d6
X bsr of44
X tst.l remembr
X beq.s ul1
X move.l #unlerr,d0
X bsr putnam
X bra ul4
Xul1 bsr ResumeOutput
X move.l #unl1,d0
X bsr putstr
X move.l 0(a7),d0
X bsr getpath
X move.l #unltxt2,d0
X bsr putstr
X bsr readline
X ori.b #$20,inputbuffer
X cmp.b #'y',inputbuffer
X bne.s ul5
X move.l 0(a7),d1
X CALL UnLock,dosbase
Xul5 bsr freefinfo
Xul4 addq #4,a7
Xul6 rts
X;---------- Show all Locks------------
Xlocks moveq #0,d6
X bra.s of33
X
X;---------- Open Files-----------
Xopenfiles moveq #1,d6
Xof33 move.l mytask(PC),a4
X move.l 184(a4),inputbuffer
X move.l #-1,184(a4)
X lea ofheader(PC),a0
X bsr puthead
Xof44 bsr allocfinfo
X bsr devinfo
X move.l a1,a3
Xof1 adda.l a3,a3
X adda.l a3,a3
X cmp.l #2,4(a3)
X bne of2
X move.l 40(a3),d0
X lsl.l #2,d0
X move.l d0,a4
X moveq #0,d3
X move.b (a4)+,d3
X subq #1,d3
X lea buffer,a5
Xof22 move.b (a4)+,(a5)+
X dbf d3,of22
X move.b #':',(a5)+
X clr.b 0(a5)
X cmp.l #'RAM ',buffer
X bne.s of5
X cmp.l #'Disk',buffer+4
X bne.s of5
X move.l #$4d3a0000,buffer+2
Xof5 move.l #buffer,d1
X move.l #-2,d2
X CALL Lock,dosbase(PC)
X tst.l d0
X bne.s of6
X move.l #buffer,d0
X bsr putstr
X move.l #nomount,d0
X bsr putnam
X bra of2
X
Xof6 move.l d0,-(a7)
X lsl.l #2,d0
X move.l d0,a5
Xof4 move.l 0(a5),d0
X cmp.l #50,d0
X ble of3
X move.l d0,d5
X lsl.l #2,d5
X move.l d5,a5
X move.l d0,d5
X tst d6
X bpl.s of45
X
X cmp.l remembr(PC),d0
X bne.s of4
X clr.l remembr
X move.l (a7)+,d1
X CALL UnLock,dosbase(PC)
X bra quitof
X
Xof45 move.l 8(a5),d4
X bsr getfinfo
X move.l finfoptr,a4
X
X tst.l d6
X beq.s of8
X bmi.s of8
X tst.l 4(a4)
X bpl of4
Xof8 move.l d5,d0
X move.l d0,node
X bsr hexa
X move.l #access,d0
X cmp #-2,d4
X beq.s of7
X addq #8,d0
Xof7 bsr putstr
X tst.l 4(a4)
X bmi.s of9
X move.l #longnix,d0
X bsr putstr
X bra of10
Xof9 move.l 124(a4),d0
X bsr longdec
Xof10 move.l d5,d0
X bsr getpath
X bra of4
X
X bsr newline
Xof3 move.l (a7)+,d1
X CALL UnLock,dosbase(PC)
Xof2 move.l 0(a3),a3
X cmpa.l #0,a3
X bne of1
X bsr freefinfo
Xquitof move.l mytask(PC),a4
X move.l inputbuffer,184(a4)
X rts
X
X;---------- Dos Devices ----------
X
Xdevices lea ddheader(PC),a0
X bsr puthead
X bsr devinfo
Xdev1 adda.l a1,a1
X adda.l a1,a1
X clr.b d6
X tst.l 4(a1)
X bne dev2
X move.l 40(a1),d0
X bsr putbcpl
X moveq #10,d1
X bsr tab
X cmp.l #20,28(a1)
X ble dev9
X moveq #1,d6
X move.l 28(a1),a3
X adda.l a3,a3
X adda.l a3,a3
X cmp.l #20,8(a3)
X ble dev9
X move.l 8(a3),a2
X adda.l a2,a2
X adda.l a2,a2
X move.l 12(a2),d3
X movem.l a1-a3,-(a7)
X bsr bytedec
X movem.l (a7)+,a1-a3
X moveq #1,d3
X move.l 20(a2),d0
X bsr longdec
X move.l 40(a2),d0
X beq.s devs20
X addq #1,d0
X sub.l 36(a2),d0
Xdevs20 bsr longdec
X move.l 44(a2),d0
X bsr longdec
X bra.s dev8
Xdev9 move.l #notfile,d0
X bsr putstr
Xdev8 tst.l 8(a1)
X beq.s dev6
X move.l #devload,d0
X bra.s dev5
Xdev6 move.l #devnload,d0
Xdev5 bsr putstr
X tst.b d6
X beq.s dev7
X move.l 4(a3),d0
X bne.s dev4
Xdev7 move.l 16(a1),d0
X bne.s dev4
X tst.l 8(a1)
X beq.s dev11
X move.l 8(a1),a3
X move.l -82(a3),d0
X bsr putstr
X bra dev11
Xdev4 bsr putbcpl
Xdev11 bsr newline
Xdev2 move.l 0(a1),a1
X cmpa.l #0,a1
X bne dev1
X rts
X
X; Check if a named dos-device is mounted
X; name in 'buffer'.
X; Result: d0 = 0(false) anything else(true).
X
Xfinddev bsr devinfo
Xfdev1 adda.l a1,a1
X adda.l a1,a1
X clr.b d6
X tst.l 4(a1)
X bne.s fdev2
X move.l 40(a1),a2
X lea buffer,a0
X bsr strbcmp
X tst d0
X bne.s fdev3
Xfdev2 move.l 0(a1),a1
X cmpa.l #0,a1
X bne.s fdev1
Xfdev3 rts
X
X; Re-assign a drive to dos
X
Xfreedrive clr.l dp_Arg1
X bra ldr3
X
X; Inhibit a disk drive
X
Xlockdrive move.l #1,dp_Arg1
Xldr3 bsr getstr
X bsr finddev
X bne.s ldr1
Xldr2 move.l #buffer,d0
X bsr putstr
X move.l #nomount,d0
X bsr putstr
X move.l #dishelp,d0
X bra putnam
Xldr1 move.l #buffer,d1
X CALL DeviceProc,dosbase(PC)
X tst.l d0
X beq.s ldr2
X move.l d0,a0
X move.l #31,dp_Type
X bra cons1
X
X;display the current directory of all processes,
X;except Workbench.(Worbench pr_CurrentDir is not a lock)
X
Xcurrentdir lea wbname(PC),a1
X CALL FindTask,_SysBase(PC)
X move.l d0,wbaddr
X lea cdheader(PC),a0
X bsr puthead
X bsr allocfinfo
X moveq #0,d5
X bsr getaskdat
X lea buffer,a5
Xcd2 tst.b entries
X beq.s cd6
X cmp.b #13,8(a5)
X bne.s cd5
X move.l wbaddr(PC),d0
X cmp.l 0(a5),d0
X beq.s cd5
X move.l 4(a5),d0
X bsr putstr
X moveq #15,d1
X bsr tab
X move.l 0(a5),a4
X move.l 152(a4),d0
Xcd1 bsr getpath
Xcd5 subq.b #1,entries
X lea 16(a5),a5
X bra.s cd2
Xcd6 bsr freefinfo
X rts
X
X;Change the current directory setting of a process
X
Xcd tst.b fromfile
X bne cd10
X move.l a0,-(a7)
X lea wbname(PC),a1
X CALL FindTask,_SysBase(PC)
X move.l d0,wbaddr
X move.l (a7)+,a0
X bsr getstr
X move.l a0,-(a7)
X move.l #buffer,d1
X move.l #-2,d2
X CALL Lock,dosbase(PC)
X move.l (a7)+,a0
X tst.l d0
X bne cd16
X move.l #dnotf,d0
X bra putnam
Xcd16 move.l d0,remembr
X move.l a0,-(a7)
X bsr allocfinfo
X move.l remembr(PC),d0
X bsr getfinfo
X move.l finfoptr,a5
X move.l (a7)+,a0
X tst.l 4(a5)
X bpl.s cd11
X move.l #notdir,d0
X bsr putnam
X bra cd18
Xcd11 bsr nodenam
X moveq.l #2,d7
X lea TRuNode(PC),a4
X bsr findnam
X tst.b d7
X beq.s cd15
X move.l d0,a5
X cmp.b #13,8(a5)
X beq.s cd15
X bsr syntax
X bra cd18
Xcd15 cmp.l wbaddr,d0
X bne.s cd13
X move.l #wberr,d0
X bsr putnam
X bra cd12
Xcd13 move.l 152(a5),d1
X move.l remembr,152(a5)
X move.l d1,remembr
Xcd12 tst.l remembr
X beq.s cd14
X bsr ResumeOutput
X move.l #unltxt,d0
X bsr putstr
X move.l remembr(PC),d0
X bsr getpath
X move.l #unltxt2,d0
X bsr putstr
X bsr readline
X ori.b #$20,inputbuffer
X cmp.b #'y',inputbuffer
X bne.s cd14
Xcd18 move.l remembr(PC),d1
X beq.s cd14
X CALL UnLock,dosbase(PC)
Xcd14 bsr freefinfo
Xcd10 rts
X
X;Display the list of inputhandlers. It adds a dummy
X;input handler, grabs the list header, and removes it
X
Xinphand tst.b background
X bne.s inph1
X bsr installh
Xinph1 move.l #500,d4
X lea InInterrupt(PC),a0
Xinph2 tst.l 4(a0)
X beq.s inph3
X move.l 4(a0),a0
X dbf d4,inph2
Xinph3 tst.b background
X bne.s inph4
X movem.l d4/a0,-(a7)
X bsr removeh
X movem.l (a7)+,d4/a0
Xinph4 cmp.w #-1,d4
X bne.s inph5
X move.l #failed,d0
X bra putnam
Xinph5 move.l a0,-(a7)
X lea inheader(PC),a0
X bsr puthead
X move.l (a7)+,a5
Xinph6 move.l 0(a5),a5
X tst.l 0(a5)
X beq.s inph7
X move.l a5,d0
X move.l d0,node
X bsr hexa
X move.l 14(a5),d0
X bsr hexa
X move.l 18(a5),d0
X bsr hexa
X move.b 9(a5),d3
X bsr plusmins
X move.l 10(a5),d0
Xinph8 bsr putnam
X bra.s inph6
Xinph7 rts
X
X;get all screen pointers.
X;result: d5=number of screens
X; buffer+100 holds pointers.
X
Xgetscr lea scrheader(PC),a0
X bsr puthead
Xgetscr2 move.l intuibase(PC),a2
X move.l 60(a2),a2
X lea buffer+100,a1
X move.w #$4000,$dff09a
X moveq #0,d5
Xsr1 move.l a2,(a1)+
X move.l 0(a2),a2
X addq.l #1,d5
X cmpa.l #0,a2
X bne.s sr1
X subq #1,d5
X move.w #-$4000,$dff09a
X rts
X
X;display screen addresses and titles
X
Xscreens bsr getscr
X moveq #1,d6
X lea buffer+100,a1
Xsr2 move d6,d3
X bsr bytedec
X move.l 0(a1),d0
X move.l d0,node
X bsr hexa
X move.l (a1)+,a2
X move.l 22(a2),d0
X bsr putnam
X addq #1,d6
X dbf d5,sr2
X rts
X
X;display window addresses and titles
X
Xwindows clr.b bool
Xwindows1 bsr getscr
X tst.b bool
X beq.s wn20
X move.l d5,-(a7)
X lea fohead(PC),a0
X bsr puthead
X move.l (a7)+,d5
Xwn20 lea buffer+100,a4
Xwn2 move.l #onscr,d0
X bsr putstr
X move.l (a4)+,a2
X move.l 22(a2),d0
X bsr putnam
X move.l 4(a2),a1
X moveq #0,d6
Xwn1 cmpa.l #0,a1
X beq.s wn3
X addq #1,d6
X move.l d6,d3
X bsr bytedec
X move.l a1,d0
X move.l d0,node
X bsr hexa
X move.l 32(a1),d0
X bsr putnam
X
X tst.b bool
X beq.s wn21
X move.l a1,-(a7)
X move.l 50(a1),a1
X move.l 52(a1),a1
X bsr fontdata
X move.l (a7)+,a1
X
Xwn21 move.l 0(a1),a1
X bra.s wn1
Xwn3 dbf d5,wn2
X rts
X
X;close a specified screen
X
Xclosescreen bsr getscr2
X moveq #1,d6
X cmp.b #'$',0(a0)
X bne.s cs1
X bsr readhex
X tst d7
X beq syntax
X move.l d0,d4
Xcsin moveq #0,d6
Xcs1 lea buffer+100,a2
Xcs5 tst d6
X bne.s cs2
X cmp.l (a2)+,d4
X beq.s cs3
X bra.s cs4
Xcs2 move.l (a2)+,a1
X move.l 22(a1),a1
X bsr strcmp
X tst d0
X beq.s cs3
Xcs4 dbf d5,cs5
X move.l #scnofound,d0
X bra putnam
Xcs3 move.l -4(a2),a0
X CALL CloseScreen,intuibase(PC)
X rts
X
X;close a specified window
Xclosewindow bsr getwnptr
Xclw move.l a4,d0
X beq.s cwend
Xcw3 tst.l 36(a4)
X beq.s cw8
X move.l 36(a4),a0
X move.w 28(a0),d0
X and.w #$4000,d0
X beq.s cw9
X move.l a4,a0
X CALL FreeSysRequest,intuibase(PC)
X rts
Xcw9 move.l a4,a1
X CALL EndRequest,intuibase(PC)
X bra.s cw3
Xcw8 move.l a4,a0
X moveq #0,d0
X CALL ModifyIDCMP,intuibase(PC)
X move.l a4,a0
X CALL CloseWindow,intuibase(PC)
Xcwend rts
X
X
Xgetwnptr bsr getscr2
X moveq #1,d6
X cmp.b #'$',0(a0)
X bne.s cw1
X bsr readhex
X tst d7
X bne.s cwin
X bsr syntax
X bra.s cwerr
Xcwin move.l d0,d4
X moveq #0,d6
Xcw1 lea buffer+100,a2
Xcw5 move.l (a2)+,a4
X move.l 4(a4),a4
Xcw6 cmpa.l #0,a4
X beq.s cw4
X tst d6
X bne.s cw2
X cmp.l a4,d4
X beq.s cw10
X bra.s cw7
Xcw2 move.l 32(a4),a1
X bsr strcmp
X tst d0
X beq.s cw10
Xcw7 move.l 0(a4),a4
X bra.s cw6
Xcw4 dbf d5,cw5
X move.l #winnofound,d0
X bsr putnam
Xcwerr suba.l a4,a4
Xcw10 rts
X
Xwindowoff movem.l d1-d7/a0-a6,-(a7)
X bsr getscr2
X bsr cwin
X move.l a4,d1
X beq.s woff1
X bsr clw
X move.l -(a2),a0
X move.l a0,d4
X tst.l 4(a0)
X bne.s woff1
X bsr getscr2
X bsr csin
Xwoff1 movem.l (a7)+,d1-d7/a0-a6
X rts
X
Xclosetskwin movem.l d1-d7/a0-a6,-(a7)
Xctw0 bsr getscr2
X lea buffer+100,a2
Xctw1 move.l (a2)+,a4
X move.l 4(a4),a4
Xctw6 cmpa.l #0,a4
X beq.s ctw4
X move.l 86(a4),a0
X move.l 16(a0),d1
X cmp.l d0,d1
X bne.s ctw7
X move.l d0,d1
X move.l a4,d0
X bsr windowoff
X move.l d1,d0
X bra ctw0
Xctw7 move.l 0(a4),a4
X bra.s ctw6
Xctw4 dbf d5,ctw1
X movem.l (a7)+,d1-d7/a0-a6
X rts
X
X;Change the font from a specified Window
X
Xsetfont bsr nodenam
X tst.b 0(a5)
X beq syntax
X move.l a5,a4
X1$ cmp.b #33,(a4)+
X bge.s 1$
X tst.b -1(a4)
X beq syntax
X clr.b -1(a4)
X
X lea dummy,a0
X move.l a5,0(a0)
X move.b procnum(PC),d0
X ext.w d0
X move.w d0,4(a0)
X clr.w 6(a0)
X CALL OpenFont,gfxbase(PC)
X tst.l d0
X bne.s 2$
X lea diskfont(PC),a1
X CALL OpenLibrary,_SysBase(PC)
X move.l d0,d5
X beq.s 4$
X move.l d0,a6
X lea dummy,a0
X XREF _LVOOpenDiskFont
X jsr _LVOOpenDiskFont(a6)
X move.l d0,d4
X move.l d5,a1
X CALL CloseLibrary,_SysBase(PC)
X move.l d4,d0
X bne.s 2$
X4$ move.l #fonterr,d0
X bsr putstr
X move.l dummy,d0
X bra putnam
X2$ move.l d0,-(a7)
X move.l a4,a0
X bsr kllblnks
X bsr getwnptr
X move.l (a7)+,a0
X move.l a4,d1
X bne.s 5$
X move.l a0,a1
X CALL CloseFont,gfxbase(PC)
X bra.s 3$
X5$ move.l 50(a4),a1
X CALL SetFont,gfxbase(PC)
X move.l a4,a0
X CALL RefreshWindowFrame,intuibase(PC)
X3$ rts
X
X
X;display windows and associated fonts
X
Xwindowfonts move.b #1,bool
X bra windows1
X
X;display loaded font names and definitions
X
Xfonts lea fohead(PC),a0
X bsr puthead
X move.l gfxbase(PC),a1
X move.l $8c(a1),a1
Xfo1 tst.l 0(a1)
X beq.s fo3
X bsr fontdata
X move.l 0(a1),a1
X bra fo1
Xfo3 rts
X
Xfontdata move.l a1,d0
X move.l d0,node
X bsr hexa
X move.w 30(a1),d3
X bsr bytedec
X move.w 20(a1),d3
X bsr bytedec
X move.w 24(a1),d3
X bsr bytedec
X move.l #romfnt,d0
X btst #1,23(a1)
X beq.s fod1
X move.l #diskfnt,d0
Xfod1 bsr putstr
X move.b 32(a1),d3
X bsr bytedec
X move.b 33(a1),d3
X bsr bytedec
X move.l 10(a1),d0
X bra putnam
X
X;set update rate
X
Xsettime bsr getnum
X tst.b d7
X bne.s st1
X move.b timeout(PC),d3
X bne.s 1$
X move.l #timenotset,d0
X bra.s sy1
X1$ move.l #whattime,d0
X bsr putstr
X bsr bytedec
X bra newline
Xst1 move.b d2,timeout
X rts
Xsyntax move.l #synerr,d0
Xsy1 bra putnam
X
X;copy a string from input to 'buffer'
X;a0 = pointer to string
X
Xgetstr lea buffer,a5
Xgst2 cmp.b #' ',0(a0)
X beq.s gst1
X cmp.b #10,0(a0)
X beq.s gst1
X move.b (a0)+,(a5)+
X bra.s gst2
Xgst1 clr.b 0(a5)
X bra kllblnks
X
X;read in a nodename or a processname
X
Xnodenam bsr isdec
X move.b d2,procnum
Xnodenam2 bsr kllblnks
X move.l a0,a5
Xgno1 cmp.b #10,(a0)+
X bne.s gno1
X move.b #0,-1(a0)
X rts
X
X;modify a task's priority
X
Xtaskpri bsr getnum
X tst.b d7
X beq syntax
X move.b d2,newpri
X bsr nodenam
X moveq.l #2,d7
X lea TRuNode(PC),a4
X bsr findnam
X tst.b d7
X beq.s tp1
X move.l d0,a1
X move.b newpri,d0
X CALL SetTaskPri,_SysBase(PC)
Xtp1 rts
X
X;set the priority of our task
X
Xmypri bsr getnum
X tst.b d7
X beq syntax
X move.l _SysBase(PC),a1
X move.l 276(a1),a1
X move.l d2,d0
X CALL SetTaskPri,_SysBase(PC)
X rts
X
X;cancel a task or a process. The theory is quite simple:
X;(Process->ReturnAddr)-4 points to the return address on
X;the stack. Task->SPReg points to the next instruction
X;to be executed. We just need a
X; *(Task->SPReg) = *(Process->ReturnAddr-4).
X;If the process has been started from Dos (CLI) and
X;the process is doing disk I/O, the CLI will respond with
X;a GURU #87000004 (AsyncPKT=unexpected packed received).
X;Thats why the calling CLI is also canceled.
X
X
Xcancel tst.b fromfile
X beq.s cancel1
X rts
Xcancel1 clr.l remembr ;used for CLI stdio
X clr.l remembr2
X clr.b bool
X bsr nodenam
Xtestagain moveq.l #1,d7
X lea TReNode(PC),a4
X bsr findnam
X tst.b d7
X bne.s canok
Xcnerr move.l #stperr,d0
X bra putnam
X
Xcanok move.l d0,a1 ;d0=task
X move.l d0,pointer
X cmp.b #1,8(a1) ;TASK ?
X bne.s isproc
X CALL RemTask,_SysBase(PC)
X move.l pointer(PC),d0
X bra closetskwin
X
Xisproc movem.l d0-d7/a0-a6,-(a7)
X move.l #-1,d0 ;needed for recursive killing tasks
X CALL AllocSignal,_SysBase(PC)
X moveq #0,d1
X bset d0,d1
X move.l d1,cancelbit
X move.l d0,cancelbnum
X movem.l (a7)+,d0-d7/a0-a6
X
X moveq #0,d5
X tst.l $ac(a1) ;pr_CLI
X beq.s wascreproc
X move.l $80(a1),a2 ;Seglist
X adda.l a2,a2
X adda.l a2,a2
X move.l 12(a2),d1 ;empty ?
X bne.s wascreproc
X move.l $ac(a1),a2 ;CommandLineInterface
X adda.l a2,a2
X adda.l a2,a2
X move.l 60(a2),d5 ;cli_Module
X tst.l 40(a2) ;IsInteractive
X beq dosreturn
X move.l 28(a2),remembr ;yes,get Cli-Window locks
X move.l 56(a2),remembr2
X bra dosreturn
Xwascreproc tst.b bool ;it is not a CLI, ask what to do
X bne unload
X move.b #3,bool
X bsr ResumeOutput
X move.l #canerr0,d0 ;ask for Workbench
X bsr putstr
X bsr readline
X cmp.b #'y',inputbuffer
X beq.s andagain
X move.b #2,bool
X bsr ResumeOutput
X move.l #canerr1,d0 ;ask for unload
X bsr putstr
X bsr readline
X cmp.b #'y',inputbuffer
X bne.s andagain
X move.b #1,bool
Xandagain move.l pointer(PC),d0
X moveq.l #1,d7
X lea TReNode(PC),a4
X bsr tstnode
X tst d5
X beq cnerr
X bra canok
X
Xunload move.l 128(a1),d4 ;get Segmentlist
X beq.s unl3
X lsl.l #2,d4
X move.l d4,a3
X move.l 12(a3),d4
Xunl3 tst.l d4
X bne.s unl4
X move.l #unloaderr,d0 ;no Segments !?
X bra putnam
X
Xunl4 cmp.b #3,bool ;Workbench Task
X bne.s unl2
X move.l a1,-(a7)
X moveq #40,d0 ;build a copy of the
X move.l #$10000,d1 ;Workbench startup-message
X CALL AllocMem,_SysBase(PC)
X move.l d0,startmess
X move.l (a7)+,a1
X move.l d0,a0
X move.b #5,8(a0)
X move.w #20,18(a0)
X move.l d4,24(a0)
X move.l a1,d0
X add.l #92,d0
X move.l d0,20(a0)
X movem.l a0-a1,-(a7)
X lea wbname(PC),a1
X CALL FindPort,_SysBase(PC)
X movem.l (a7)+,a0-a1
X move.l d0,14(a0)
X
Xunl2 cmp.b #1,bool
X bne.s dosreturn
X move.l a1,-(a7) ;unload process manualy
X move.l d4,d1
X CALL UnLoadSeg,dosbase(PC)
X move.l (a7)+,a1
X
Xdosreturn move.l 140(a1),savedat ;Processnumber
Xdosret1 move.w #$4000,$dff09a
X move.l 54(a1),a3
X move.l #endtask,0(a3)
X move.l #2,106(a1)
X move.l mytask(PC),108(a1)
X cmp.b #4,15(a1) ;if waiting
X bne.s doswait
X move.l a1,d4
X CALL Remove,_SysBase(PC)
X move.l d4,a1
X lea 406(a6),a0 ; activate the task
X CALL AddHead,_SysBase(PC)
X move.l d4,a1
Xdoswait move.w #-$4000,$dff09a
X tst.b bool
X bne.s endnodos
X tst.l d5
X beq endcanc
X move.l $ac(a1),a2
X adda.l a2,a2
X adda.l a2,a2
Xdwa1 movem.l d0-d7/a0-a6,-(a7)
X move.l cancelbit(PC),d0
X CALL Wait,_SysBase(PC)
X movem.l (a7)+,d0-d7/a0-a6
X moveq #0,d5
X bra dosret1
X
Xendcanc move.l a1,-(a7)
X move.l remembr(PC),d1 ;close CLI-Window
X beq.s ecan1 ;if any
X CALL Close,dosbase(PC)
Xecan1 move.l remembr2(PC),d1
X beq.s ecan2
X CALL Close,dosbase(PC)
Xecan2 move.l (a7)+,a1
X
X move.l savedat(PC),d0 ;remove Task from
X move.l dosbase(PC),a2 ;TaskArray
X move.l 34(a2),a2
X move.l 0(a2),a2
X adda.l a2,a2
X adda.l a2,a2
X lsl.l #2,d0
X clr.l 0(a2,d0)
X
Xendnodos move.l a1,d0
X bsr closetskwin
X move.l cancelbnum(PC),d0 ;remove our Signal
X CALL FreeSignal,_SysBase(PC)
X rts
X
X;This Code is (hopefully) excuted by the Process we want
X;to kill
X
Xendtask CALL Forbid,_SysBase(PC)
X CALL Disable,_SysBase(PC)
X move.l _SysBase(PC),a1
X move.l 276(a1),a1
X move.l 176(a1),a1 ;Process_ReturnAddr
X lea -4(a1),a7 ;reset Process Stackptr
X tst.b bool
X bne.s et0
X movea.l mytask(PC),a1
X move.l cancelbit(PC),d0 ;signal Xoper it
X CALL Signal,_SysBase(PC) ;died
Xet0 cmp.b #3,bool ;Workbench Process ?
X bne.s et1
X move.l startmess(PC),a1
X CALL ReplyMsg,_SysBase(PC) ;reply startup message
Xet1 rts
X
X;Stop a task (just queue it on a special list)
X
Xfreeze bsr nodenam
X moveq.l #1,d7
X lea TReNode(PC),a4
X bsr findnam
X tst.b d7
X bne.s frok
X move.l #stperr,d0
X bra putstr
Xfrok move.w #$4000,$dff09a
X move.l d0,a1
X CALL Remove,_SysBase(PC)
X move.w #-$4000,$dff09a
X move.l d0,a1
X move.l d0,a5
X lea stplist(PC),a0
X CALL AddHead,_SysBase(PC)
X add.b #4,15(a5)
X rts
X;put the task back on its list
Xwarm bsr nodenam
X cmp.b #'$',0(a5)
X bne.s 1$
X move.l d7,d2
X move.l a5,a0
X bsr readhex
X tst.b d7
X beq.s 1$
X move.l stplist(PC),a3
X3$ tst.l 0(a3)
X beq.s 2$
X cmp.l a3,d0
X beq.s waok
X move.l 0(a3),a3
X bra.s 3$
X1$ lea stplist(PC),a0
X movea.l a5,a1
X moveq #0,d7
X bsr fn4
X tst.b d7
X bne.s waok
X2$ move.l #waerr,d0
X bra putstr
Xwaok move.w #$4000,$dff09a
X move.l d0,a1
X CALL Remove,_SysBase(PC)
X move.l d0,a1
X move.l d0,a5
X move.l TReNode,a0
X cmp.b #8,15(a1)
X bne.s wa1
X move.l TWaNode,a0
Xwa1 adda.l _SysBase(PC),a0
X CALL AddTail,_SysBase(PC)
X move.l d0,a1
X subq.b #4,15(a5)
X move.w #-$4000,$dff09a
X move.l 18(a5),d0
X and.l 26(a5),d0
X beq.s wa2
X movea.l a5,a1
X CALL Signal,_SysBase(PC)
Xwa2 rts
X;show the hunks of a process
Xhunks bsr nodenam
X moveq.l #2,d7
X lea TRuNode(PC),a4
X bsr findnam
X tst.b d7
X bne.s hu1
X rts
Xhu1 move.l d0,a4
X cmp.b #13,8(a4)
X beq.s hu2
X move.l #noprocs,d0
X bra putnam
Xhu2 move.l 128(a4),d0
X beq.s noprogload
X lsl.l #2,d0
X move.l d0,a3
X move.l 12(a3),d1
X beq.s hu3
X move.l #segloaded,d0
X bsr putnam
X bra hu5
Xhu3 move.l 172(a4),d1
X bne.s hu4
Xnoprogload move.l #notload,d0
X bra putnam
Xhu4 move.l #cliprocs,d0
X bsr putnam
X lsl.l #2,d1
X move.l d1,a4
X move.l 60(a4),d1
X beq.s noprogload
X move.l #procloaded,d0
X bsr putstr
X move.l 16(a4),d0
X bsr putbcpl
X bsr newline
Xhu5 lea hunkheader(PC),a0
X bsr puthead
X moveq #0,d5
Xhu6 move.l d5,d3
X bsr bytedec
X addq #1,d5
X move.l d1,d0
X bsr hexa
X lsl.l #2,d1
X move.l d1,a4
X move.l d1,d0
X addq.l #4,d0
X bsr hexa
X move.l -4(a4),d0
X bsr hexa
X bsr newline
X move.l 0(a4),d1
X bne.s hu6
X rts
X;change the priority of a node
Xpri bsr getnum
X tst.b d7
X beq syntax
X move.b d2,newpri
X bsr nodenam2
X moveq.l #5,d7
X lea DevNode(PC),a4
X bsr findnam
X tst.b d7
X beq.s pi1
X move.l d0,a1
X move.b newpri,9(a1)
X cmp.l #SemNode,a4
X ble.s pi2
X move.l #listerr,d0
X bra putnam
Xpi2 CALL Forbid,_SysBase(PC)
X CALL Remove,_SysBase(PC)
X move.l d0,a1
X move.l a4,a0
X move.l 0(a0),d6
X lea 0(a6,d6),a0
X CALL Enqueue,_SysBase(PC)
X CALL Permit,_SysBase(PC)
Xpi1 rts
X;set all break signals of a task
Xbreak move.l #$f000,d0
X bra setthem
X
Xsignal bsr readhex
X tst.b d7
X beq syntax
Xsetthem move.l d0,savedat
X bsr nodenam
X moveq.l #2,d7
X lea TReNode(PC),a4
X bsr findnam
X tst.b d7
X beq.s pi1
X move.l d0,a1
X move.l savedat,d0
X and.l 18(a1),d0
X CALL Signal,_SysBase(PC)
X rts
X
X;set up a list of tasknames which should't be displayed
X
Xhide cmp.b #10,0(a0)
X bne.s hid5
X bra syntax
Xhid5 lea hidestart(PC),a2
X move.l a2,d3
Xhid0 tst.l 0(a2)
X beq.s hid1
X move.l 0(a2),a2
X lea 4(a2),a1
X bsr strcmp
X tst d0
X beq.s hid2
X move.l a2,d3
X bra.s hid0
Xhid1 move.l a0,a4
X bsr strlen2
X addq #5,d0
X move.l #65536,d1
X CALL AllocMem,_SysBase(PC)
X tst.l d0
X beq.s hid4
X move.l d0,a1
X move.l d0,0(a2)
X addq #4,a1
Xhid3 cmp.b #10,0(a4)
X beq.s hid4
X move.b (a4)+,(a1)+
X bra.s hid3
Xhid4 rts
Xhid2 move.l d3,a3
X move.l 0(a2),0(a3)
Xfreehidden lea 4(a2),a0
X bsr strlen
X addq #5,d0
X move.l a2,a1
X CALL FreeMem,_SysBase(PC)
X rts
X
Xfreehidmem move.l hidestart(PC),a4
Xfhm0 move.l a4,d0
X beq.s fhm1
X move.l a4,a2
X move.l 0(a2),a4
X bsr freehidden
X bra fhm0
Xfhm1 rts
X
X;set up an ALIAS list
Xalias cmp.b #10,0(a0)
X beq showalias
X bsr strbuf
X move.l a0,a5
X lea buffer,a0
X bsr strlen
X tst.l d0
X beq syntax
X
X moveq #1,d1
X cmp d1,d0
X bne.s 5$
X lea params(PC),a0
X moveq #parmnum-1,d1
X move.b buffer,d2
X6$ cmp.b (a0)+,d2
X dbeq d1,6$
X tst.w d1
X bmi.s 5$
X move.l #aliaserr,d0
X bsr putstr
X move.l #params,d0
X bsr putstr
X move.l #aliaserr2,d0
X bra putnam
X
X5$ move.l d0,d5
X move.l a5,a0
X adda.l d0,a0
X bsr kllblnks
X move.l a5,-(a7)
X bsr findcmd
X move.l (a7)+,a5
X tst.l d2
X bmi syntax
X move.l a5,a0
X bsr strbuf
X
X addq #6,d5
X move.l d5,d0
X move.l #65536,d1
X CALL AllocMem,_SysBase(PC)
X tst.l d0
X beq.s 1$
X
X move.l aliaslist(PC),d1
X bne.s 2$
X move.l d0,aliaslist
X bra.s 3$
X2$ move.l d1,a0
X move.l 0(a0),d1
X bne.s 2$
X move.l d0,0(a0)
X
X3$ move.l d0,a0
X move.b d2,4(a0)
X
X lea 5(a0),a0
X lea buffer,a1
X4$ move.b (a1)+,(a0)+
X bne.s 4$
X1$ rts
X
Xshowalias lea alhead(PC),a0
X bsr puthead
X move.l aliaslist(PC),d0
X beq.s 1$
X2$ move.l d0,a5
X addq #5,d0
X bsr putstr
X move.w #15,d1
X bsr tab
X move.l #equal,d0
X bsr putstr
X move.b 4(a5),d0
X ext.w d0
X bsr getcmdptr
X bsr putnam
X move.l 0(a5),d0
X bne.s 2$
X1$ rts
X
Xfreealias move.l aliaslist(PC),a4
X1$ move.l a4,d0
X beq.s 2$
X move.l a4,a2
X move.l 0(a2),a4
X lea 5(a2),a0
X bsr strlen
X addq #6,d0
X move.l a2,a1
X CALL FreeMem,_SysBase(PC)
X bra 1$
X2$ rts
X
Xgetcmdptr move.l a0,-(a7)
X lea commds(PC),a0
X2$ tst d0
X beq.s 1$
X3$ tst.b (a0)+
X bne.s 3$
X subq #1,d0
X bra.s 2$
X1$ move.l a0,d0
X move.l (a7)+,a0
X rts
X
X
X;'flushlibs'
Xflush move.l #$ffffff,d0
X moveq #0,d1
X CALL AllocMem,_SysBase(PC)
Xflsh1 rts
X
X;display library->lib_IDString
Xinfo bsr nodenam2
X moveq.l #2,d7
X lea DevNode(PC),a4
X bsr findnam
X tst.b d7
X beq.s flsh1
X move.l d0,a0
X move.l 24(a0),d0
X beq.s if1
X move.l d0,d1
X andi.l #1,d1
X bne.s if1
X bra putnam
Xif1 move.l #noinfo,d0
X bsr putstr
X move.l a5,d0
X bra putnam
X
Xcapture move.l _SysBase(PC),a1
X lea 42(a1),a0
X moveq #2,d6
X lea coldtxt,a4
Xcap0 move.l a4,d0
X bsr putstr
X move.l 0(a0),d0
X bne.s cap1
X move.l #unset,d0
X bsr putstr
X bra cap2
Xcap1 bsr hexa
Xcap2 bsr newline
X lea 15(a4),a4
X addq #4,a0
X dbf d6,cap0
X
X move.l #kicktxt,d0
X bsr putstr
X move.l 546(a1),a0
X cmpa.l #0,a0
X bne.s kickm3
X move.l #unset,d0
X bra putnam
Xkickm3 move.l a0,-(a7)
X bsr newline
X lea kickhead(PC),a0
X bsr puthead
X move.l (a7)+,a0
Xkickm0 move.l a0,d0
X beq kickm4
X bpl.s kickm1
X bclr #31,d0
X move.l d0,a0
X bra.s kickm0
Xkickm1 move.w 14(a0),d6
X subq #1,d6
X lea 16(a0),a2
Xkickm2 move.l 0(a2),d0
X bsr hexa
X move.l 0(a2),d0
X move.l 4(a2),d4
X add.l d4,d0
X bsr hexa
X move.l d4,d0
X clr.b d3
X bsr longdec
X bsr newline
X addq #8,a2
X dbf d6,kickm2
X move.l 0(a0),a0
X bra kickm0
Xkickm4 rts
X
Xclrcold move.l _SysBase,a0
X clr.l 42(a0)
X bra.s chksum
Xclrcool move.l _SysBase,a0
X clr.l 46(a0)
X bra.s chksum
Xclrwarm move.l _SysBase,a0
X clr.l 50(a0)
X
Xchksum lea 34(a0),a1
X move #22,d0
Xaddchk add (a1)+,d1
X dbf d0,addchk
X not d1
X move.w d1,82(a0)
X rts
X
X;Save the command line to be repeated. If this line doesn't produce
X;any output, don't repeat it at all
Xrepeatcmd tst.w repeat
X bne.s 2$
X move.w repeatlen(PC),d0
X subq #7,d0
X move.w d0,repeatlen
X lea repeatbuffer,a1
X lea dummy,a2
X move.w d0,d1
X ext.l d1
X1$ move.b 0(a0),(a1)+
X move.b (a0)+,(a2)+
X dbf d1,1$
X
X clr.l lastprinted
X clr.b printed
X move.w #1,repeat
X bsr cli
X tst.b printed
X beq.s 2$
X bsr starttimer
X rts
X2$ clr.w repeat
X rts
X
X;save the parameters from a 'window x y width height' call
Xsetwindow tst.b fromfile
X bne.s wiw1
Xwiw3 move.l #wiwerr,d0
X bra putnam
Xwiw1 lea window_l(PC),a3
X moveq #3,d5
Xwiw0 bsr getnum
X tst d7
X beq.s wiw2
X move.w d2,0(a3)
X addq #2,a3
X dbf d5,wiw0
Xwiw2 rts
X
X;display ExecBase->LastAlert
Xlastalert movem.l $100,d1-d2
X tst.l d1
X bne.s al1
X move.l _SysBase(PC),a0
X movem.l 514(a0),d1-d2
Xal1 move.l #gurutxt,d0
X bsr putstr
X move.l d1,d0
X bsr hexa
X lea out,a0
X move.l ptr(PC),d0
X move.b #'.',-1(a0,d0)
X move.l d2,d0
X bsr hexa
X bra newline
X
X;toggle CPUSE task list
Xusage bchg #0,usageflag
X rts
X
X;toggle task-header display on/off
Xnohead bchg #0,headon
X rts
X
X;toggle hide entries on/off
Xhidden bchg #0,hideon
X rts
X
X;toggle sort on/off
Xsort bchg #0,sorton
X rts
X
X;toggle task-ports display on/off
Xtaskports bchg #0,tports
Xclo1 rts
X
X;Open a library
Xopenlib bsr nodenam2
X move.l a5,a1
X moveq #0,d0
X CALL OpenLibrary,_SysBase(PC)
X tst.l d0
X beq fn5
Xopli1 rts
X
X
X;close it
Xcloselib bsr nodenam2
X moveq #0,d7
X lea LibNode(PC),a4
X bsr findnam
X tst.b d7
X beq.s clo1
X move.l d0,a1
X CALL CloseLibrary,_SysBase(PC)
X rts
X
Xremnode bsr nodenam2
X moveq #7,d7
X lea TReNode(PC),a4
X bsr findnam
X tst.b d7
X beq.s 1$
X CALL Disable,_SysBase(PC)
X move.l d0,a1
X CALL Remove,_SysBase(PC)
X CALL Enable,_SysBase(PC)
X1$ rts
X
X;end Xoper but stay in background
Xhold addq #4,a7
X bra.s instback
Xquithold lea in,a0
X lea dummy,a1
Xqh1 move.b (a1)+,d0
X move.b d0,(a0)+
X cmp.b #10,d0
X bne.s qh1
X
Xinstback tst.b background
X bne.s cleanit
X move.b #1,background
X bsr installh
Xcleanit move.l fileptr(PC),d1
X beq.s ib1
X CALL Close,dosbase(PC)
X clr.l fileptr
Xib1 clr.b running
X bsr killpage
X bsr freeblank
X tst.l wnptr
X beq.s 5$
X tst.b ownscreen
X bne.s 6$
X move.l wnptr(PC),a0
X move.l 4(a0),window_l
X move.l 8(a0),window_w
X6$ move.l wnptr(PC),a0
X CALL CloseWindow,intuibase(PC)
X clr.l intuimsg
X clr.l wnptr
X5$ tst.b ownscreen
X beq.s 4$
X move.l screenptr(PC),a0
X CALL CloseScreen,intuibase(PC)
X clr.l screenptr
X
X4$ tst.b iconifyon
X beq.s 1$
X jsr iconify
X bra.s 2$
X
X1$ move.l mysignal(PC),d0
X or.l trapsignal(PC),d0
X CALL Wait,_SysBase(PC)
X2$ move.b #1,running
X and.l trapsignal(PC),d0
X beq.s 3$
X move.b #1,gotguru
SHAR_EOF
echo "End of archive 1 (of 3)"
# if you want to concatenate archives, remove anything after this line
exit